-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: login page #446 #450
Conversation
@AE-Hertz is attempting to deploy a commit to the bunty's projects Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes in this pull request primarily involve updates to the contributors' section of the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊 |
if you can upgrade the level that would be appreciated. thank you/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (8)
frontend/src/components/Pages/verifyRegisterOtp.jsx (2)
Line range hint
28-47
: Enhance input validation for better security.While basic validation is implemented, consider strengthening it:
-if (!email || !/\S+@\S+\.\S+/.test(email)) { +const EMAIL_REGEX = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; +if (!email || !EMAIL_REGEX.test(email)) { setError('Please enter a valid email address'); setIsLoading(false); return; } -if (otp.length !== 6) { +if (otp.length !== 6 || !/^\d{6}$/.test(otp)) { setError('Please enter a valid 6-digit OTP'); setIsLoading(false); return; }
Line range hint
89-117
: Enhance accessibility for error messages and loading states.The current implementation has good accessibility features, but could be improved:
{error && ( - <div className="w-full p-2 bg-red-100 text-red-700 border border-red-400 rounded-md"> + <div + role="alert" + aria-live="polite" + className="w-full p-2 bg-red-100 text-red-700 border border-red-400 rounded-md"> {error} </div> )} <button type="submit" - className="button-confirm mx-auto mt-12 px-4 w-30 h-10 rounded-md border-2 border-black bg-beige shadow-[4px_4px_0px_0px_black] text-[17px] font-semibold text-[#323232] cursor-pointer active:shadow-none active:translate-x-[3px] active:translate-y-[3px]" + className={`button-confirm mx-auto mt-12 px-4 w-30 h-10 rounded-md border-2 border-black ${ + isLoading ? 'bg-gray-200' : 'bg-beige' + } shadow-[4px_4px_0px_0px_black] text-[17px] font-semibold text-[#323232] cursor-pointer active:shadow-none active:translate-x-[3px] active:translate-y-[3px] disabled:opacity-50 disabled:cursor-not-allowed`} disabled={isLoading} + aria-busy={isLoading} > {isLoading ? 'Submitting...' : 'Verify OTP →'} </button>frontend/src/components/Pages/Login.jsx (3)
Line range hint
15-15
: Review security implications of Remember Me feature.The implementation of Remember Me looks good, but consider these security aspects:
- The 7-day token expiration for Remember Me could increase security risks
- Consider adding refresh token mechanism for long-lived sessions
- Cookie security attributes are properly set (secure, sameSite)
Consider implementing:
- Refresh token rotation
- Activity-based token refresh
- Server-side session tracking
Also applies to: 33-40
70-70
: Improve dark mode accessibility and consistency.The dark mode implementation could benefit from these enhancements:
- Consider using CSS variables for consistent shadow colors
- Ensure sufficient contrast ratios for dark mode text
- Standardize the shadow implementation
- className="... dark:shadow-[4px_4px_0px_0px_grey] ..." + className="... dark:shadow-[4px_4px_0px_0px_var(--shadow-dark)] ..."Add to your CSS:
:root { --shadow-dark: rgb(75, 75, 75); }Also applies to: 80-80, 89-89, 138-138, 148-148
Line range hint
95-104
: Enhance password toggle button accessibility.While the password toggle functionality works, consider these accessibility improvements:
<button className="absolute top-1/2 transform -translate-y-1/2 right-4" + type="button" + aria-label={hidden ? "Show password" : "Hide password"} onClick={(e) => { e.preventDefault(); setHidden(!hidden); }} > {hidden ? <FaEyeSlash /> : <FaEye />} </button>frontend/src/components/Pages/Signup.jsx (3)
131-137
: Enhance password toggle button accessibility.While the toggle functionality works, consider these accessibility improvements:
<button className="absolute top-1/2 transform -translate-y-1/2 right-4" + type="button" + aria-label={hidden ? "Show password" : "Hide password"} onClick={(e) => { e.preventDefault(); setHidden(!hidden); }} >
Line range hint
28-50
: Strengthen email validation logic.Consider using a more robust email validation pattern instead of the basic '@' check:
- if (!data.email.includes('@')) { + const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + if (!emailPattern.test(data.email)) { setError('Please enter a valid email address'); setIsLoading(false); return; }
101-101
: Consider refining dark mode color scheme.The current dark mode uses amber-800 which might be too intense. Consider a more neutral background color for better readability:
- className="z-10 p-8 lg:p-16 bg-[#f1e9dc] dark:bg-amber-800 dark:text-white flex flex-col gap-6 rounded-lg border-2 border-black shadow-[4px_4px_0px_0px_black] dark:shadow-[4px_4px_0px_0px_grey]" + className="z-10 p-8 lg:p-16 bg-[#f1e9dc] dark:bg-gray-800 dark:text-white flex flex-col gap-6 rounded-lg border-2 border-black shadow-[4px_4px_0px_0px_black] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,0.2)]"Also applies to: 110-110, 117-117, 125-125
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
frontend/src/assets/login-opt.png
is excluded by!**/*.png
📒 Files selected for processing (5)
README.md
(9 hunks)frontend/src/components/Pages/EmailVerify.jsx
(1 hunks)frontend/src/components/Pages/Login.jsx
(5 hunks)frontend/src/components/Pages/Signup.jsx
(6 hunks)frontend/src/components/Pages/verifyRegisterOtp.jsx
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- frontend/src/components/Pages/EmailVerify.jsx
🧰 Additional context used
🪛 Markdownlint
README.md
371-371: Column: 1
Hard tabs
(MD010, no-hard-tabs)
372-372: Column: 1
Hard tabs
(MD010, no-hard-tabs)
415-415: Column: 1
Hard tabs
(MD010, no-hard-tabs)
416-416: Column: 1
Hard tabs
(MD010, no-hard-tabs)
459-459: Column: 1
Hard tabs
(MD010, no-hard-tabs)
460-460: Column: 1
Hard tabs
(MD010, no-hard-tabs)
503-503: Column: 1
Hard tabs
(MD010, no-hard-tabs)
504-504: Column: 1
Hard tabs
(MD010, no-hard-tabs)
547-547: Column: 1
Hard tabs
(MD010, no-hard-tabs)
548-548: Column: 1
Hard tabs
(MD010, no-hard-tabs)
591-591: Column: 1
Hard tabs
(MD010, no-hard-tabs)
592-592: Column: 1
Hard tabs
(MD010, no-hard-tabs)
🔇 Additional comments (5)
frontend/src/components/Pages/verifyRegisterOtp.jsx (1)
Line range hint 48-67
: Verify API endpoint security implementation.
The API endpoint handling sensitive OTP verification should be properly secured:
#!/bin/bash
# Check for other instances of this API endpoint to ensure consistent security measures
rg -g '!node_modules' -g '!dist' -A 3 '/api/user/verify'
Consider implementing:
- Rate limiting for OTP verification attempts
- CSRF protection tokens
- Request timeout for security
frontend/src/components/Pages/Login.jsx (1)
2-2
: Verify image optimization metrics.
While the image has been renamed to indicate optimization (login-opt.png
), let's verify the actual size reduction matches the 60% target mentioned in the PR objectives.
✅ Verification successful
Let me calculate the reduction percentage manually from the obtained sizes:
- Original size: 4,273,500 bytes
- Optimized size: 1,291,834 bytes
- Reduction: ((4,273,500 - 1,291,834) / 4,273,500) * 100 = 69.77%
Image optimization exceeds the target reduction goal ✓
The optimized image (login-opt.png
) shows a size reduction of approximately 70% compared to the original image (login.png
), which surpasses the PR objective of 60% reduction. This change effectively contributes to improved page load performance.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Compare the size of original and optimized images
echo "Checking image sizes..."
original_size=$(find . -name "login.png" -exec ls -l {} \; | awk '{print $5}')
optimized_size=$(find . -name "login-opt.png" -exec ls -l {} \; | awk '{print $5}')
if [ ! -z "$original_size" ] && [ ! -z "$optimized_size" ]; then
reduction=$(echo "scale=2; (($original_size - $optimized_size) / $original_size) * 100" | bc)
echo "Size reduction: $reduction%"
fi
Length of output: 484
frontend/src/components/Pages/Signup.jsx (3)
2-2
: Image optimization implemented effectively!
The changes successfully address the performance concerns:
- Lazy loading improves initial page load
- Responsive sizing with max-width constraints prevents overflow
- Using optimized image version (-opt suffix) reduces file size
Also applies to: 94-98
93-93
: Layout improvements effectively prevent overflow!
The container and form layout changes successfully:
- Prevent page overflow with overflow-hidden
- Maintain responsiveness with adaptive padding
- Control maximum widths for different screen sizes
Also applies to: 101-101
2-2
: Verify image size reduction.
Let's confirm the image optimization achieved the target 60% size reduction:
✅ Verification successful
Let me try a simpler verification script without relying on bc
:
Image optimization successfully exceeds the target reduction
The optimization has achieved a 69.77% size reduction (from 4.27MB to 1.29MB), surpassing the target of 60%. This significant compression maintains image quality while improving page load performance.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Compare sizes of original and optimized images
original_size=$(fd -t f "login.png" | xargs ls -l | awk '{print $5}')
optimized_size=$(fd -t f "login-opt.png" | xargs ls -l | awk '{print $5}')
if [ ! -z "$original_size" ] && [ ! -z "$optimized_size" ]; then
reduction=$(echo "scale=2; (($original_size - $optimized_size) / $original_size) * 100" | bc)
echo "Size reduction: $reduction%"
if (( $(echo "$reduction < 60" | bc -l) )); then
echo "Warning: Image size reduction is less than the target 60%"
fi
fi
Length of output: 511
Script:
#!/bin/bash
# Compare sizes of original and optimized images
original_size=$(fd -t f "login.png" | xargs ls -l | awk '{print $5}')
optimized_size=$(fd -t f "login-opt.png" | xargs ls -l | awk '{print $5}')
if [ ! -z "$original_size" ] && [ ! -z "$optimized_size" ]; then
echo "Original size: $original_size bytes"
echo "Optimized size: $optimized_size bytes"
# Manual calculation: (4273500 - 1291834) / 4273500 * 100 ≈ 69.77%
fi
Length of output: 350
@@ -1,5 +1,5 @@ | |||
import { Link, useNavigate, useParams } from 'react-router-dom'; | |||
import photo from '../../assets/login.png'; | |||
import photo from '../../assets/login-opt.png'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
🛠️ Refactor suggestion
Image optimization needed - 1.3MB file size exceeds performance targets
The verification reveals critical performance concerns:
- The image file size is 1.3MB, which is significantly large for web use
- No WebP alternative exists
- Current implementation lacks width/height attributes that prevent CLS
To achieve the PR's 60% file size reduction goal:
- Convert the image to WebP format (expected size: ~400KB)
- Implement responsive images with proper dimensions
- Add explicit width/height attributes
<img
src={photo}
alt="verify"
loading="lazy"
width="800"
height="600"
className="w-3/4 absolute object-contain"
/>
🔗 Analysis chain
Verify image optimization for performance.
While the image has been updated and includes lazy loading, consider the following optimizations to align with the PR's performance objectives:
Consider implementing the following improvements:
- Add explicit width and height attributes to prevent layout shifts
- Use modern image formats like WebP with PNG fallback
- Consider implementing responsive images using srcset for different viewport sizes
-<img src={photo} alt="verify" loading="lazy" className="w-3/4 absolute" />
+<img
+ src={photo}
+ alt="verify"
+ loading="lazy"
+ width="800"
+ height="600"
+ className="w-3/4 absolute object-contain"
+/>
Also applies to: 2-2
Let me try another approach to verify the image-related concerns.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check the size of the new image
find . -name "login-opt.png" -exec ls -lh {} \;
Length of output: 420
Script:
#!/bin/bash
# Search for the image file in different locations
fd "login-opt.png" --type f --exec ls -lh {}
# Check for any WebP versions of the image
fd "login-opt.webp" --type f
# Look for other image imports in the component
rg -l "from.*\.(png|jpg|jpeg|webp|gif)" frontend/src/components/Pages/verifyRegisterOtp.jsx
# Check image usage in the component
rg -A 2 "<img.*src=\{.*\}" frontend/src/components/Pages/verifyRegisterOtp.jsx
Length of output: 512
<div className="w-screen h-screen pt-10 flex flex-col lg:flex-row items-center justify-center lg:space-x-10 px-4 dark:bg-black"> | ||
{/* Background Image */} | ||
<img | ||
src={photo} | ||
alt="login" | ||
loading="lazy" | ||
className="absolute w-3/4 lg:w-auto lg:opacity-100 opacity-10 object-cover" | ||
className="w-3/4 max-w-xs lg:max-w-2xl lg:w-1/2 object-contain mb-6 lg:mb-0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance image loading and responsiveness.
While the current implementation addresses overflow issues, consider these improvements:
<img
src={photo}
alt="login"
loading="lazy"
- className="w-3/4 max-w-xs lg:max-w-2xl lg:w-1/2 object-contain mb-6 lg:mb-0"
+ className="w-3/4 max-w-xs lg:max-w-2xl lg:w-1/2 object-contain mb-6 lg:mb-0 aspect-auto"
+ onError={(e) => {
+ e.target.onerror = null;
+ e.target.src = 'fallback-image.png';
+ }}
/>
Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
README.md (1)
371-372
: Fix markdown formatting: Replace hard tabs with spaces.There are several instances of hard tabs in the markdown file. While they render correctly, it's best practice to use spaces for consistent formatting across different editors and platforms.
Also applies to: 440-441, 486-487, 539-540, 585-586
🧰 Tools
🪛 Markdownlint
371-371: Column: 1
Hard tabs(MD010, no-hard-tabs)
372-372: Column: 1
Hard tabs(MD010, no-hard-tabs)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
README.md
(9 hunks)frontend/src/components/Pages/Signup.jsx
(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- frontend/src/components/Pages/Signup.jsx
🧰 Additional context used
🪛 Markdownlint
README.md
371-371: Column: 1
Hard tabs
(MD010, no-hard-tabs)
372-372: Column: 1
Hard tabs
(MD010, no-hard-tabs)
440-440: Column: 1
Hard tabs
(MD010, no-hard-tabs)
441-441: Column: 1
Hard tabs
(MD010, no-hard-tabs)
486-486: Column: 1
Hard tabs
(MD010, no-hard-tabs)
487-487: Column: 1
Hard tabs
(MD010, no-hard-tabs)
539-539: Column: 1
Hard tabs
(MD010, no-hard-tabs)
540-540: Column: 1
Hard tabs
(MD010, no-hard-tabs)
585-585: Column: 1
Hard tabs
(MD010, no-hard-tabs)
586-586: Column: 1
Hard tabs
(MD010, no-hard-tabs)
🔇 Additional comments (1)
README.md (1)
Line range hint 1-700
: Verify alignment with PR objectives.
The PR description and linked issue (#446) discuss enhancements to the login page, including fixing toggle password functionality and image optimization. However, the changes in this file only update the contributors list. Please ensure:
- The login page enhancements are included in other files
- The PR description accurately reflects all changes being made
✅ Verification successful
Let me check the login page changes to verify alignment with PR objectives.
Let me check the image optimization changes.
PR changes align with objectives and show improvements
The changes in this PR successfully address both mentioned objectives:
- Toggle password functionality is properly implemented in Login.jsx using FaEye/FaEyeSlash icons and state management
- Image optimization is achieved with login-opt.png (1.3MB) being significantly smaller than login.png (4.1MB), a ~68% reduction in size
The PR description accurately reflects the changes being made.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for files related to login page changes
echo "Searching for login-related files..."
fd -e jsx -e js -e ts -e tsx "login|Login"
# Search for image-related changes
echo "Searching for image-related changes..."
fd -e png -e jpg -e jpeg -e webp
Length of output: 2840
Script:
#!/bin/bash
# Check the content of Login.jsx
echo "Content of Login.jsx:"
cat frontend/src/components/Pages/Login.jsx
# Check git changes for Login.jsx
echo -e "\nGit changes for Login.jsx:"
git diff frontend/src/components/Pages/Login.jsx
Length of output: 5995
Script:
#!/bin/bash
# Check git changes for the login-related images
echo "Git changes for login images:"
git diff frontend/src/assets/login.png frontend/src/assets/login-opt.png
# Get file sizes of the login images
echo -e "\nFile sizes of login images:"
ls -lh frontend/src/assets/login*.png
Length of output: 449
🧰 Tools
🪛 Markdownlint
371-371: Column: 1
Hard tabs
(MD010, no-hard-tabs)
372-372: Column: 1
Hard tabs
(MD010, no-hard-tabs)
<a href="https://github.com/jainaryan04"> | ||
<img src="https://avatars.githubusercontent.com/u/138214350?v=4" width="100;" alt="jainaryan04"/> | ||
<br /> | ||
<sub><b>Haseeb Zaki</b></sub> | ||
<sub><b>Aryan Ramesh Jain</b></sub> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on contributor updates, but please check for duplicates.
The contributor updates look good, but there are duplicate entries for some contributors:
- Sajal Batra appears twice
- PavanTeja2005 appears twice
- Sourabh Singh Rawat appears twice
Please remove the duplicate entries to maintain a clean contributors list.
Also applies to: 270-273, 293-296, 300-303, 365-368, 374-377, 388-414, 488-493
@AE-Hertz resolve the conflicts |
merge conflicts resolved. |
if you can upgrade the level that would be appreciated . thank you |
@RamakrushnaBiswal can you please merge before anymore conflicts arises. thank you. |
d5ccf80
into
RamakrushnaBiswal:main
Enhancement: login page #446
Closes: #446
Things which have been improved-
Before:
After:
Summary by CodeRabbit
Release Notes
New Features
Improvements
Documentation